package com.clgc.utils;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @author lsr
 * @create 2021-05-25-16:55
 */
public class MyListUtils {

    public static List GetRandomThreeInfoList(List list, int count) {
        List olist = new ArrayList<>();
        if (list.size() <= count) {
            return list;
        } else {
            Random random = new Random();
            for (int i = 0; i < count; i++) {
                int intRandom = random.nextInt(list.size() - 1);
                olist.add(list.get(intRandom));
                list.remove(list.get(intRandom));
            }
            return olist;
        }
    }
}
